﻿using JmShared;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace JiveMessenger.Models
{
    public class JiveCustomEmoticonModel : INotifyPropertyChanged,IEquatable<JiveCustomEmoticonModel>,IEmoticon
    {
        public EmoticonType Type
        {
            get
            {
                return EmoticonType.CustomEmoticon;
            }
        }

        private string _emoticonShortcut;
        public string EmoticonShortcut
        {
            get { return _emoticonShortcut; }
            set
            {
                if (_emoticonShortcut != value)
                {
                    _emoticonShortcut = value;
                    RaisePropertyChanged("EmoticonShortcut");
                }
            }
        }

        private string _emoticonPath;
        public string EmoticonPath
        {
            get { return _emoticonPath; }
            set
            {
                if (_emoticonPath != value)
                {
                    _emoticonPath = value;
                    RaisePropertyChanged("EmoticonPath");
                }
            }
        }

        public JiveCustomEmoticonModel()
        {

        }

        public override int GetHashCode()
        {
            return (this.EmoticonShortcut + this.EmoticonPath).GetHashCode();
        }
        public override bool Equals(object obj)
        {
            return Equals(obj as JiveCustomEmoticonModel);
        }
        public bool Equals(JiveCustomEmoticonModel other)
        {
            if (other == null)
                return false;
            return this.EmoticonPath == other.EmoticonPath && this.EmoticonShortcut == other.EmoticonShortcut;
        }

        protected virtual void RaisePropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
        }
        public event PropertyChangedEventHandler PropertyChanged;
    }
}
